package com.csnj.common.entity;

import lombok.Data;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 查询参数
 */
@Data
public class Query extends LinkedHashMap<String, Object> {
	private static final long serialVersionUID = 1L;
    //当前页码
    private int pageNum = 1;
    //每页条数
    private int pageSize = 12;
    private String key = null;

    public Query(Map<String, Object> params){
        this.putAll(params);
        //分页参数
        if(params.get("pageNum")!=null) {
            this.pageNum = Integer.parseInt(params.get("pageNum").toString());
        }
        if(params.get("pageSize")!=null) {
            this.pageSize = Integer.parseInt(params.get("pageSize").toString());
        }
        if(params.get("query") != null) {
            this.key = params.get("query").toString();
        }
        this.remove("query");
        this.remove("pageNum");
        this.remove("pageSize");
    }
}
